﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Logoned.Master" Inherits="System.Web.Mvc.ViewPage<CourseSystem.Core.Entities.ExaminationInfo>" %>

<%@ Import Namespace="Chowpoo.Util" %>
<%@ Import Namespace="CourseSystem.Common.Helpers" %>
<%@ Import Namespace="CourseSystem.Core.BLL" %>
<%@ Import Namespace="CourseSystem.Core.Enum" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%=(Model.Type==0||Model.Type==2)?"练习":"作业" %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
        <% Html.RenderPartial("TopUc"); %>
        <% Html.RenderPartial("NavUc", 3); %>
        <% Html.RenderPartial("ExamLibNavUc", (Model.Type == 0 || Model.Type == 2) ? 1 : 0); %>
    </table>
    <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td height="200" align="center" valign="top" class="contentBackImg">
                <table width="980" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <% Html.RenderAction("ChapterTreeUc", new { id = (Model.Type == 0 || Model.Type == 1) ? Model.SectionInfo.Id : 0, Model.Type }); %>
                        <td width="23">
                            &nbsp;
                        </td>
                        <td width="748" align="center" valign="top">
                            <table width="748" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="45">
                                        <img src="<%=ResolveUrl("~/Content/images/6_03.gif") %>" width="45" height="25" />
                                    </td>
                                    <td width="700" class="sectionTitle">
                                        <div align="left" class="style18 style34">
                                            <% if (Model.SectionId != 0)
                                               {%>
                                            <%=Model.SectionInfo.Name%><%}
                                               else
                                               { %>整门课程<% } %>
                                        </div>
                                    </td>
                                    <td width="100">
                                        <img src="<%=ResolveUrl("~/Content/images/6_04.gif") %>" width="100" height="25" />
                                    </td>
                                </tr>
                            </table>
                            <% var isLearn = true;
                               if (Model.Type < 2)
                               {
                                   isLearn = UserHelper.LoginUser.UserType >= UserTypeEnum.Teacher || SectionLearnBLL.Get(Model.SectionId, UserHelper.Student.Id) != null;
                               }
                               if (!isLearn)
                               { %>请学习该章节后再进行练习或作业.<%}
                               else
                               { %>
                            <table width="600" height="" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td>
                                        <div align="center">
                                            <% if (Model.Type == 0 || Model.Type == 1)
                                               { %>
                                            <p id="countDownP">
                                            </p>
                                            <% } %>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <% Html.RenderPartial("ExamDoUc", Model); %><% } %>
                        </td>
                    </tr>
                </table>
                <table width="1000" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td height="10">
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <style type="text/css">
        .stylenew1 { font-size: 14px; font-weight: bold; font-family: "宋体"; color: #BC7E3F; }
        .stylenew2 { font-size: 36px; font-family: "宋体"; color: #0000FF; font-weight: bold; }
        .stylenew3 { font-size: 18px; }
        .stylenew4 { font-size: 12px; font-family: "宋体"; }
        .stylenew8 { color: #FF0000; }
        .stylenew10 { color: #33CC66; }
        .stylenew13 { color: #FFCC33; }
    </style>
    <script src="<%=ResolveUrl("~/Scripts/jquery.jcountdown1.3.min.js") %>" type="text/javascript"></script>
    <script type="text/javascript">
        <% var countDownDay = Model.Type == 0 ? DateTime.Now.AddMinutes(Model.LimitTime) : Model.EndTime; %>
        $(function () {
            $("#countDownP").countdown({
                date: strToTime('<%=countDownDay.ToString("yyyy-MM-dd HH:mm:ss") %>'), //Counting TO a date
                htmlTemplate: "<span class=\"stylenew2\">%{h}<span class=\"stylenew3\">时</span>%{m}<span class=\"stylenew3\">分</span>%{s}<span class=\"stylenew3\">秒</span></span>",
                //date: "july 1, 2011 19:24", //Counting TO a date
                onChange: function (event, timer) {
                },
                onComplete: function (event) {
                    $(this).html("<span class=\"stylenew2 stylenew8\">已结束</span>");
                    $("#countDownP").countdown('pause');
                },
                leadingZero: true
            });
        });
    </script>
</asp:Content>
